Conversation
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> |
| <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> |
There was a problem hiding this comment.
I wonder if it would be worth using configurations more liberally so dockerfiles, workflows, etc. could just pass configurations and the meanings could be contained in a propertygroup like this.
| namespace Peer.Daemon.Linux | ||
| { | ||
| internal class Program | ||
| { | ||
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | ||
| static async Task Main() | ||
| { | ||
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | ||
| File.Delete(_socketPath); | ||
|
|
||
| var app = ServerBuilder.CreateHost(cfg => | ||
| { | ||
| cfg.WebHost.UseKestrel(kestrel => | ||
| { | ||
| kestrel.ListenUnixSocket(_socketPath, opts => | ||
| { | ||
| opts.Protocols = HttpProtocols.Http2; | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| await app.RunAsync(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
| namespace Peer.Daemon.Linux | |
| { | |
| internal class Program | |
| { | |
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | |
| static async Task Main() | |
| { | |
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | |
| File.Delete(_socketPath); | |
| var app = ServerBuilder.CreateHost(cfg => | |
| { | |
| cfg.WebHost.UseKestrel(kestrel => | |
| { | |
| kestrel.ListenUnixSocket(_socketPath, opts => | |
| { | |
| opts.Protocols = HttpProtocols.Http2; | |
| }); | |
| }); | |
| }); | |
| await app.RunAsync(); | |
| } | |
| } | |
| } | |
| namespace Peer.Daemon.Linux; | |
| internal class Program | |
| { | |
| private const string _socketPath = "/var/run/peerless/peerless.sock"; | |
| static async Task Main() | |
| { | |
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | |
| File.Delete(_socketPath); | |
| var app = ServerBuilder.CreateHost(cfg => | |
| { | |
| cfg.WebHost.UseKestrel(kestrel => | |
| { | |
| kestrel.ListenUnixSocket(_socketPath, opts => | |
| { | |
| opts.Protocols = HttpProtocols.Http2; | |
| }); | |
| }); | |
| }); | |
| await app.RunAsync(); | |
| } | |
| } |
| static async Task Main() | ||
| { | ||
| Directory.CreateDirectory(Directory.GetParent(_socketPath)!.FullName); | ||
| File.Delete(_socketPath); |
There was a problem hiding this comment.
Would this blow up an already running instance if a second one were started? I wonder if it would better to be aggressive about cleanup and fail to start if the socket is already open? I bet there's prior art about this somewhere.
| using Grpc.Net.Client; | ||
| using Peerless; | ||
|
|
||
| namespace Geas; |
| // package peerless; | ||
|
|
||
| service PullRequestGrpcService { | ||
| rpc GetPullRequest(GetPullRequestRequest) returns (GetPullRequestResponse); |
There was a problem hiding this comment.
RequestRequest 🤮 I get it though.
| message State { | ||
| PRStatus status = 1; | ||
| int32 total_comments = 2; | ||
| int32 active_comments =3; |
There was a problem hiding this comment.
| int32 active_comments =3; | |
| int32 active_comments =3; |
| var src = host.Services.GetRequiredService<EndpointDataSource>(); | ||
| return host; |
| } | ||
|
|
||
| //Linux | ||
| public partial class SpecialPaths |
There was a problem hiding this comment.
This doesn't compile conditionally, wouldn't these paths end up being used on Windows too?
Just an initial experimenting branch I've had around for a bit where I'm trying to see how I wanna structure the Daemon stuff.
I've got separate projects for the Windows and linux daemons because I wanted to test if it would cause any differences with trimming etc. It doesn't seem to have any impact so I'll be merging them together again and probably going to nuke the Server project entirely.
Other than that I'm basically thinking of just using named pipes on windows and UDS on linux/mac to do IPC and then just polling in the background as we do now to populate a teeny SQLite server that we update. I figure it'd be kinda neat to do it with change streaming and tracking certain things though it's kinda hard because the GH api makes so few promises to you about the actual correctness of your data (looking at you status flags)
In order to do a bunch of this I had to bump to net 8 and preview versions (for named pipe support in kestrel). Also I added some really horrendous annotations on the generics to make them compatible with the trimming stuff but god I hope there's a better way to do it going forward. Those required C#11 to work properly.
edit: Oh also I was experimenting with the CodeGenerator configuration stuff but it wasn't working for me so I have it gated behind the Release-Preview build which I don't think I actually added atm.
edit2: I also added a little commandline util called 'Geas' to handle experimenting with it before implementing it in Peer